<template>
	<view class="content">
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="item.id" @click="to(item.id)">
				<view class="info">
					<view class="title font24 fontw">
						{{item.title}}
					</view>
					<view class="des font18" v-html="item.text">
					</view>
					<view class="bottom">
						<view class="from font18">
							来自：分享
						</view>
						<view class="iconB">
							<view class="ping">
								<image src="https://wx.caobenjiankang.com/image/technicianadd/ping.png" mode="aspectFit"></image>
								<view class="num font18">
									{{item.field.length}}
								</view>
							</view>
							<view class="zan">
								<image src="https://wx.caobenjiankang.com/image/technicianadd/zan.png" mode="aspectFit"></image>
								<view class="num font18">
									{{item.zan_num}}
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="image">
					<image :src="item.image" mode="aspectFit"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				info: {
					page: 1,
					pageSize: 10
				},
				total: 1
			};
		},
		onReachBottom() {
			if (this.info.page >= this.total) {
				uni.showToast({
					icon: 'error',
					title: '暂无更多',
					duration: 1000
				})
			} else {
				this.info.page = this.info.page + 1
				this.getData()
			}
		},
		onLoad() {

		},
		onShow() {
			this.list = []
			this.getData()
		},
		methods: {
			async getData() {
				const data = await this.$api.technicianadd.myCollectArticle()
				console.log(data, 'data');
				if (data.data.length > 0) {
					this.list = [...this.list, ...data.data]
				}
			},
			to(id) {
				uni.navigateTo({
					url: '/technicianadd/pages/text/text?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 36rpx 34rpx;

		.list {
			.item {
				display: flex;
				align-items: center;
				margin-bottom: 18rpx;
				background-color: #fff;
				border-radius: 21rpx;
				padding: 21rpx 33rpx;

				.info {
					flex: 1;

					.title {
						margin-bottom: 15rpx;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 1;
						/* 定义显示的行数 */
						overflow: hidden;
						text-overflow: ellipsis;
					}

					.des {
						color: #666666;
						margin-bottom: 60rpx;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 1;
						/* 定义显示的行数 */
						overflow: hidden;
						text-overflow: ellipsis;
					}

					.bottom {
						display: flex;
						align-items: center;

						.from {
							margin-right: 16rpx;
						}

						.iconB {
							display: flex;
							align-items: center;

							.ping {
								display: flex;
								align-items: center;
								margin-right: 16rpx;

								image {
									width: 32rpx;
									height: 32rpx;
								}

								.num {
									margin-left: 8rpx;
								}
							}

							.zan {
								display: flex;
								align-items: center;

								image {
									width: 32rpx;
									height: 32rpx;
								}

								.num {
									margin-left: 8rpx;
								}
							}
						}
					}
				}

				.image {
					width: 200rpx;
					height: 200rpx;
					background: #1EB481;
					border-radius: 11rpx;
					overflow: hidden;
					margin-left: 16rpx;

					image {
						width: 200rpx;
						height: 200rpx;
					}
				}
			}
		}

		.popup {
			padding: 27rpx 40rpx;

			.title {
				margin-bottom: 21rpx;
			}

			.des {
				margin-bottom: 61rpx;
			}

			.left {
				justify-content: space-between;

				.describe {
					margin-bottom: 21rpx;
				}

				.container {
					color: #666666;
				}
			}

			.text {
				display: flex;
				flex-direction: column;
				margin-bottom: 55rpx;

				.describe {
					margin-bottom: 21rpx;
				}

				.uni-textarea {
					min-height: 181rpx;
					background: #7E7E7E30;
					border-radius: 20rpx;
					padding: 27rpx 24rpx;
				}
			}

			.btn {
				height: 80rpx;
				background: linear-gradient(0deg, #24B682 0%, #97DD97 100%);
				border-radius: 100rpx;
				color: #FFFFFF;
				text-align: center;
				line-height: 80rpx;
			}
		}
	}
</style>